using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
class Program
{
    static void Main()
    {
        //int[] numbers = { 0, 64, 0, 8, 0, 12, 224, 0 };
        //int[] numbers = { 3, 0, 0, 0, 0, 0, 0, 0 };
        int[] numbers = new int[8];
 
        for (int i = 0; i < 8; i++)
        {
            numbers[i] = int.Parse(Console.ReadLine());
        }
 
        int[,] field = new int[8, 8];
 
        int[] counter = new int[8];
 
        int sum_left = 0;
        int sum_right = 0;
 
        int pillar = -1;
        int sumresult = -1;
 
        for (int i = 0; i < 8; i++)
        {
            for (int j = 0; j < 8; j++)
            {
                field[i, j] = numbers[i] % 2;
 
                numbers[i] /= 2;
            }
        }
 
        //Print_multi(field);
 
        for (int i = 0; i < 8; i++)
        {
            int count = 0;
            for (int j = 0; j < 8; j++)
            {
                if (field[j, i] == 1)
                {
                    count++; 
                }
            }
            counter[i] = count;
            count = 0;
        }
 
 
        for (int i = 0; i < counter.Length; i++)
        {
            for (int j = 0; j < i; j++)
            {
                sum_left = sum_left + counter[j];
            }
            for (int j = i + 1; j <= 7; j++)
            {
                sum_right = sum_right + counter[j];
            }
            if (sum_left == sum_right)
            {
                pillar = i;
                sumresult = sum_left;
            }
            else
            {
                sum_left = 0;
                sum_right = 0;
            }
        }
        if (sumresult == -1)
        {
            Console.WriteLine("No");
        }
        else
        {
            Console.WriteLine(pillar);
            Console.WriteLine(sumresult);
        }
    }
 
    static void Print_multi(int[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            for (int j = 0; j < array.GetLength(1); j++)
            {
                Console.Write(array[i, j]);
            }
 
            Console.WriteLine();
        }
    }
    static void Print_single(int[] array)
    {
        foreach (var item in array)
        {
            Console.Write(item);
        }
        Console.WriteLine();
    }
}